package cn.itsource.blog.controller;

import cn.itsource.blog.service.IMenuService;
import cn.itsource.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private IMenuService menuService;

    /**
     * 扎实文章类型结构
     * @return
     */
    @PatchMapping("/treeMenus")
    public JsonResult treeMenus(){
        try{
            return JsonResult.success(menuService.treeMenus());
        }catch (Exception e){
            e.printStackTrace();
            return JsonResult.error(e.getMessage());
        }
    }

}
